import time
from public.action import *
from public.business import *
from public.testData import *
from public.tools import *
from selenium.webdriver.support.select import Select


attribute_name = '天天向上'
testCase = "DBshop019"
firefox = openBrowser(urlAdmin)
DBshopLoginAdmin(firefox)
DBshopEnterMenu3(firefox,'商品管理','商品属性','属性')
firefox.find_element_by_partial_link_text('添加属性').click()

s =Select(firefox.find_element_by_id('attribute_group_id'))
s.select_by_visible_text('好好学习')

firefox.find_element_by_id('attribute_name').send_keys(attribute_name)

firefox.find_element_by_xpath('//button[contains(.,"保存属性信息")]').click()
time.sleep(5)

try:
    firefox.find_element_by_xpath('//td[contains(.,"%s")]'%attribute_name)
    writeLog("%s 测试通过" % testCase)
except:
    writeLog("%s 测试失败" % testCase)
    getPhoto(firefox)

firefox.quit()